<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <script src="../../js/load.js"></script>
</head>

<body>
    <div id="container">
        <div id="formcontainer">
            <form class="layui-form layui-form-pane" id="editform" lay-filter="editform">
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label required">原名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="fileName" id="fileName" autocomplete="off" class="layui-input required">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label required">新名称</label>
                            <div class="layui-input-block">
                                <input type="text" name="newfileName" id="newfileName" autocomplete="off" class="layui-input required">
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <div id="opcontainer">
            <button class="layui-btn" onclick="HandleSave()">确认</button>
            <button class="layui-btn layui-btn-primary" onclick="HandleClose()">关闭</button>
        </div>
    </div>
</body>
<script>
    var editor;
    $(function () {
        $("#fileName").val(GetUrlParamV2("fileName"));
        $("#newfileName").val(GetUrlParamV2("fileName"))
    })

    function HandleSave() {
      SubmitForm('editform', 'api/system/file/rename', BeforeSubmit, null, function (result, status) {
            if (result.code == 0) {
                OpenSuccess('重命名成功', function (params) {
                    CloseDialog();
                })
            } else {
                OpenFail(result.msg);
            }
        })
    }

    function BeforeSubmit(data) {
        data.prefix = GetUrlParamV2("prefix");
        return true;
    }

    function HandleClose() {
        CloseDialog();
    }
</script>

</html>